import { defineStore } from 'pinia';
export const useUserStore = defineStore('user', {
  state: () => ({
    token:  '',
    userInfo: {}
  }),
  actions: {
    setToken(token: string) {
      this.token = token;
    },
    setUserInfo(info: object) {
      this.userInfo = info;
    },
    clear() {
      this.token = '';
      this.userInfo = {};
    }
  },
  persist: true // 开启持久化
});